//
//  ManagerCollectionViewCell.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/11/8.
//  Copyright © 2016年 KKING. All rights reserved.
//

#import "ManagerWebViewController.h"
#import "ManagerCollectionViewCell.h"
#import "ManagerButton.h"
#import "Masonry.h"
#import "FalseImgViewController.h"
#import "HeadlineController.h"

@interface ManagerCollectionViewCell()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leftCenterConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *rightCenterConstraint;



@property (weak, nonatomic) IBOutlet ManagerButton *scaleGrowthButton;
@property (weak, nonatomic) IBOutlet ManagerButton *businessScaleButton;
@property (weak, nonatomic) IBOutlet ManagerButton *smallScaleFarmingButton;
@property (weak, nonatomic) IBOutlet ManagerButton *landScaleButton;

@property (weak, nonatomic) IBOutlet ManagerButton *soilFlowFundButton;
@property (weak, nonatomic) IBOutlet ManagerButton *seedMoneyButton;
@property (weak, nonatomic) IBOutlet ManagerButton *fertilizerFundsButton;
@property (weak, nonatomic) IBOutlet ManagerButton *pesticideFundsButton;
/** imageView */
@property (weak, nonatomic) UIImageView * backImageView;
@end
@implementation ManagerCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // 82.5
    CGFloat centervalue = 82.5 * 2;
    self.rightCenterConstraint.constant = (centervalue * 0.5) / 375 * [UIScreen mainScreen].bounds.size.width;
    self.leftCenterConstraint.constant = -(centervalue * 0.5) / 375 * [UIScreen mainScreen].bounds.size.width;
    
    // Initialization code
    self.scaleGrowthButton.nameLabel.text = @"规模增长";
    self.scaleGrowthButton.iconImageView.image = [UIImage imageNamed:@"规模增长"];
    
    self.businessScaleButton.nameLabel.text = @"业务规模";
    self.businessScaleButton.iconImageView.image = [UIImage imageNamed:@"业务规模"];
    
    self.smallScaleFarmingButton.nameLabel.text = @"小农规模";
    self.smallScaleFarmingButton.iconImageView.image = [UIImage imageNamed:@"小农规模"];
    
    self.landScaleButton.nameLabel.text = @"土地规模";
    self.landScaleButton.iconImageView.image = [UIImage imageNamed:@"土地规模"];
    
    self.soilFlowFundButton.nameLabel.text = @"土流资金";
    self.soilFlowFundButton.iconImageView.image = [UIImage imageNamed:@"土流资金"];
    
    self.seedMoneyButton.nameLabel.text = @"种子资金";
    self.seedMoneyButton.iconImageView.image = [UIImage imageNamed:@"种子资金"];
    
    self.fertilizerFundsButton.nameLabel.text = @"肥料资金";
    self.fertilizerFundsButton.iconImageView.image = [UIImage imageNamed:@"肥料资金"];
    
    self.pesticideFundsButton.nameLabel.text = @"农药资金";
    self.pesticideFundsButton.iconImageView.image = [UIImage imageNamed:@"农药资金"];
    
    //sn_note:=========  ============================ stone 🐳 ===========/
    
    //sn_note:=========  ============================ stone 🐳 ===========/
}

/*
 种子资金
 https://www.zhuoyinong.com:444/zhuoxin_web/seed_funds.html
 种子用量
 https://www.zhuoyinong.com:444/zhuoxin_web/seed_dosage.html
 肥料用量
 https://www.zhuoyinong.com:444/zhuoxin_web/fertilize_dosage.html
 肥料资金
 https://www.zhuoyinong.com:444/zhuoxin_web/fertilize_funds.html
 业务规模
 https://www.zhuoyinong.com:444/zhuoxin_web/business_scale.html
 业务增长规模
 https://www.zhuoyinong.com:444/zhuoxin_web/business_growth_scale.html
 土地规模
 https://www.zhuoyinong.com:444/zhuoxin_web/land_scale.html
 农户规模
 https://www.zhuoyinong.com:444/zhuoxin_web/smallholdes_scale.html
 种植计划
 https://www.zhuoyinong.com:444/zhuoxin_web/plant_plan.html
 
 */
/** 规模增长 */
- (IBAction)scaleGrowthButtonClick:(ManagerButton *)sender {
    
//    [self pushViewControllerWithImageName:@"领导驾驶舱-规模增长"];
    NSLog(@"%@ | %s",self.class,__func__);
     [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/business_growth_scale.html"];
}
/** 业务规模 */
- (IBAction)businessScaleButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
        [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/business_scale.html"];
//    [self pushViewControllerWithImageName:@"领导驾驶舱-业务规模"];
    
}

/** 小农规模 */
- (IBAction)smallScaleFarmingButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
        [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/smallholdes_scale.html"];
//    [self pushViewControllerWithImageName:@"领导驾驶舱-小农规模"];
    
}
/** 土地规模 */
- (IBAction)landScaleButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
        [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/land_scale.html"];
//    [self pushViewControllerWithImageName:@"领导驾驶舱-土地规模"];
}

/** 土流资金 */
- (IBAction)soilFlowFundButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
//        [self pushViewControllerWithURLString:@"http://www.baidu.com"];
    [self pushViewControllerWithImageName:@"领导驾驶舱-土流资金"];
    
}
/** 种子资金 */
- (IBAction)seedMoneyButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
        [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/seed_funds.html"];
//    [self pushViewControllerWithImageName:@"领导驾驶舱-种子资金"];
}
/** 肥料资金 */
- (IBAction)fertilizerFundsButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
        [self pushViewControllerWithURLString:@"https://www.zhuoyinong.com:444/zhuoxin_web/fertilize_funds.html"];
//    [self pushViewControllerWithImageName:@"领导驾驶舱-肥料资金"];
}
/** 农药资金 */
- (IBAction)pesticideFundsButtonClick:(ManagerButton *)sender {
    NSLog(@"%@ | %s",self.class,__func__);
//        [self pushViewControllerWithURLString:@"http://www.baidu.com"];
    [self pushViewControllerWithImageName:@"领导驾驶舱-农药资金"];
}



- (void)pushViewControllerWithURLString:(NSString *)urlString
{
    HeadlineController * vc = [HeadlineController new];
    vc.url = urlString;
    UIResponder * next = [self nextResponder];
    
    while (next != nil) {
        
        if ([next isKindOfClass:UINavigationController.class]) {
            
            [((UINavigationController *)next) pushViewController:vc animated:YES];
            break;
        }
        
        next = [next nextResponder];
    }
}


/**
 假数据版本

 @param imageName ..
 */
- (void)pushViewControllerWithImageName:(NSString *)imageName
{
    FalseImgViewController *fVc = [[FalseImgViewController alloc]init];
    fVc.imgName = imageName;
    [self.nav pushViewController:fVc animated:YES];
}



@end
